package cn.sangyy.basic.utils;

import cn.sangyy.org.domain.Employee;
import cn.sangyy.org.domain.Shop;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author SangYY
 * @date: 2023/05/27/10:13
   登录信息获取和设置
 */
public class LoginContext {

    public static void setLoginInfo(HttpServletRequest request){

    }

    public static Employee getLoginInfo(HttpServletRequest request){
        String token = request.getHeader("token");
        Employee employee = new Employee();
        Shop shop = new Shop();
        if(StringUtils.isBlank(token)){
            //未登录。。。。
            employee.setId(340L);
            employee.setUsername("姚桑");
            shop.setId(48L);
            shop.setName("姚桑成都温江官方旗舰店");
        }else {
            //有token，从redis中获取用户信息
        }
        employee.setShop(shop);
        return employee;
    }
}
